﻿<navigation:Page 
  x:Class="DemoDataGridToolBar.Views.OData_dir_editWait" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

		xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"						 
		xmlns:mac="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls"
		xmlns:mar="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls.OData"
    xmlns:od="clr-namespace:System.Windows.Controls;assembly=Slma.OData"
    xmlns:service="clr-namespace:DemoDataGridToolBar.CustomService"
								 
					 mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="800" d:DesignHeight="480"
           Title="RIA_dir_edit Page">

  <Grid x:Name="LayoutRoot">

    <od:ODataSource x:Name="dsProducts" EntitySetName="Products" >
      <od:ODataSource.DataServiceContext>
        <service:CustomContext />
      </od:ODataSource.DataServiceContext>
      <od:ODataSource.SortDescriptions>
        <od:SortDescriptionOData  ColumnName="Name" Direction="Ascending"  />
      </od:ODataSource.SortDescriptions>
    </od:ODataSource>
    <StackPanel Orientation="Vertical" Margin="0,20,0,0" Width="800">
      <CheckBox  IsChecked="{Binding ElementName=tb1, Path=AutoSubmit, Mode=TwoWay}" Content="{StaticResource ls_auto_submit}" />
      <mar:DataGridToolBarOData  
        x:Name="tb1" Height="45" Margin="0,0,0,2" AutoSubmit="False" ButtonAddNewVisible="True" ButtonEditVisible="True"
				DataGrid="{ Binding ElementName=dgProducts, Mode=OneTime }"	
				ODataSource="{ Binding ElementName=dsProducts, Mode=OneTime}"
				CreateDataForm="DataGridToolBarRIA_CreateDataForm"															 
				>
        <mar:DataGridToolBarOData.ColumnsForFiltering>
          <mac:DataGridToolBarFilterItem ColumnName="Name"  />
          <mac:DataGridToolBarFilterItem ColumnName="ProductNumber"  />
          <mac:DataGridToolBarFilterItem ColumnName="Color"  />
          <mac:DataGridToolBarFilterItem ColumnName="Size"  />
          <mac:DataGridToolBarFilterItem ColumnName="ListPrice"  />
          <mac:DataGridToolBarFilterItem ColumnName="Weight"  />
          <mac:DataGridToolBarFilterItem ColumnName="SellStartDate"  />
        </mar:DataGridToolBarOData.ColumnsForFiltering>
        <mar:DataGridToolBarOData.Content>
          <data:DataPager x:Name="dpTest" PageSize="10" Source="{Binding ElementName=dsProducts, Path=Data}" BorderThickness="0" Background="Transparent" ></data:DataPager>
        </mar:DataGridToolBarOData.Content>
      </mar:DataGridToolBarOData>


      <mac:maDataGrid x:Name="dgProducts" Height="300" AutoGenerateColumns="False" 	  
				IsReadOnly="False"							
				ItemsSource="{Binding ElementName=dsProducts, Path=Data }"
				>
        <data:DataGrid.Columns>
          <data:DataGridTextColumn Header="{StaticResource ls_product_name}"
						Width="150" MaxWidth="300" MinWidth="40" 
						Binding="{Binding Name}" />
          <data:DataGridTextColumn Header="{StaticResource ls_product_poductnumber}"
						Width="120" MaxWidth="300" MinWidth="40" 
						Binding="{Binding ProductNumber}"/>
          <data:DataGridTextColumn Header="{StaticResource ls_product_color}"
						Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Color, Mode=TwoWay}"/>
          <data:DataGridTextColumn Header="{StaticResource ls_product_size}"
						Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Size}"  ElementStyle="{StaticResource ElementStyle_right}"/>
          <data:DataGridTextColumn Header="{StaticResource ls_product_listprice}"
						Width="90" MaxWidth="300" MinWidth="30" 
						Binding="{Binding ListPrice }" ElementStyle="{StaticResource ElementStyle_right}" />
          <data:DataGridTextColumn Header="{StaticResource ls_product_weight}"
						Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Weight}"  ElementStyle="{StaticResource ElementStyle_right}">
          </data:DataGridTextColumn>
          <data:DataGridTextColumn Header="{StaticResource ls_product_sellstartdate}"
						Width="100" MaxWidth="300" MinWidth="30" 
						Binding="{Binding SellStartDate, StringFormat=d}"  ElementStyle="{StaticResource ElementStyle_right}"/>
        </data:DataGrid.Columns>
      </mac:maDataGrid>
      <TextBlock Text="Query string"/>
      <TextBlock x:Name="txbURL" Text="{Binding ElementName=dsProducts, Path=QueryURL}" TextWrapping="Wrap" />
    </StackPanel>
    <mac:WaitControl IsBusy="{Binding ElementName=dsProducts,Path=IsBusy,Mode=OneWay}" Cancel="WaitControl_Cancel" />
  </Grid>
</navigation:Page>
